﻿using System;
using UnityEngine;

public struct PointInt
{
    public int x;
    public int y;

    public PointInt(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    public PointInt(Vector2Int vector2Int)
    {
        this.x = vector2Int.x;
        this.y = vector2Int.y;
    }

    public Vector2Int vector2Int => new Vector2Int(x, y);

    public static PointInt one => new PointInt(1, 1);
    public static PointInt zero => new PointInt(0, 0);

    public static PointInt operator *(PointInt a, PointInt b)
    {
        return new PointInt(a.x * b.x, a.y * b.y);
    }

    public static PointInt operator *(int a, PointInt b)
    {
        return new PointInt(a * b.x, a * b.y);
    }

    public static PointInt operator *(PointInt a, int b)
    {
        return new PointInt(a.x * b, a.y * b);
    }
    public static PointInt operator +(PointInt a, int b)
    {
        return new PointInt(a.x + b, a.y + b);
    }

    public static bool operator ==(PointInt a, PointInt b)
    {
        return a.x == b.x && a.y == b.y;
    }

    public static bool operator !=(PointInt a, PointInt b)
    {
        return a.x != b.x || a.y != b.y;
    }

    public static bool operator ==(PointInt a, Vector2Int b)
    {
        return a.x == b.x && a.y == b.y;
    }

    public static bool operator !=(PointInt a, Vector2Int b)
    {
        return a.x != b.x || a.y != b.y;
    }

    public static bool operator ==(Vector2Int a, PointInt b)
    {
        return a.x == b.x && a.y == b.y;
    }

    public static bool operator !=(Vector2Int a, PointInt b)
    {
        return a.x != b.x || a.y != b.y;
    }

    public static implicit operator string(PointInt v)
    {
        return v.ToString();
    }

    public override string ToString()
    {
        return $"({x},{y})";
    }
}